\section{Generating all outputs from a {\tt noweb} file} The copyright applies both to the {\tt noweb} source and to the generated shell script. <>= # Copyright 1991 by Norman Ramsey. All rights reserved. # See file COPYRIGHT for more information. Here's the organization of the source: <>= #!/bin/sh <> LIB=|LIBDIR| markup=$LIB/markup mntopt=-L status=0 tex=1 output=1 <> if [ $# -eq 0 ]; then <>; fi for source do if [ -n "$output" ]; then PATH="$PATH:$LIB" $markup -t $source | $LIB/mnt -t8 "$mntopt" -all || status=1 if [ -n "$tex" ]; then <> || status=1 exit $status {\tt noweb} could be modified to follow two Knuth-like and {\tt nuweb}-like conventions: \begin{itemize} \item Treat multiple white space within chunk names as single blanks, and ignore leading and trailing whitespace. \item Permit chunk names to be abbreviated by writing an initial subsequence of the name followed by ``[[...]]''. \end{itemize} The modification is simple; just add these two programs to the pipeline. ([[disambiguate]] is an Icon program found in the [[icon]] directory of the [[noweb]] distribution.) <>= sed -e '/^@[ud][se][ef][ n]/s/[ ][ ]*/ /g' \ -e '/^@[ud][se][ef][ n]/s/ $//' <>= $LIB/disambiguate When writing {\TeX} output, I call [[$markup]] a second time to expand tabs. %% timings on nuweb % markup 0.4u 0.1s % noxref 3.9u 1.0s % nawk 6.5u 0.2s <>= texname=`echo $source | sed '/\./s/\.[^.]*$//'` texname="$texname.tex" PATH="$PATH:$LIB" $markup $source | $LIB/finduses -noquote | $LIB/noidx -delay | nawk '{print} /^@defn [^ ]*$/ { print "@literal \\let\\nwnotused=\\nwoutput{}" }' | $LIB/totex -delay | cpif $texname <>= while [ $# -gt 0 ]; do case $1 in -to|-ot) tex= output= ; shift ;; -t) tex= ; shift ;; -o) output= ; shift ;; -L*) mntopt="$1" ; shift ;; -markup) markup="$2" ; shift; shift ;; -*) echo "Unrecognized option $1" 1>&2; exit 1 ;; *) break ;; esac <>= echo "Usage: $0 [-L[fmt] -t -o] file [...]" 1>&2; exit 1